package com.hang.gymmanager.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hang.gymmanager.Enum.OrderTypeEnum;
import com.hang.gymmanager.entity.OrderEntity;
import com.hang.gymmanager.mapper.ActivityMapper;
import com.hang.gymmanager.mapper.CourseMapper;
import com.hang.gymmanager.mapper.OrderMapper;
import com.hang.gymmanager.req.PageOrderReq;
import com.hang.gymmanager.res.OrderDetailRes;
import com.hang.gymmanager.res.PageOrderRes;
import com.hang.gymmanager.service.ActivityService;
import com.hang.gymmanager.service.CommodityService;
import com.hang.gymmanager.service.CourseService;
import com.hang.gymmanager.service.OrderService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * @author wyq
 * @version v1.0.0
 * @explain
 * @date 2024/3/22 15:11
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> implements OrderService {


    private final OrderMapper orderMapper;

    private final CommodityService commodityService;
    private final CourseMapper courseMapper;
    private final ActivityMapper activityMapper;

    @Override
    public Page<PageOrderRes> pageAllOrder(PageOrderReq req) {
        Page page = new Page(req.getPageNum(),req.getPageSize());
        Page<PageOrderRes> res = orderMapper.pageAllOrder(req,page);
        return res;
    }

    @Override
    public OrderDetailRes detail(Long orderId) {
        OrderDetailRes res = new OrderDetailRes();
        OrderEntity orderEntity = this.getBaseMapper().selectById(orderId);
        BeanUtils.copyProperties(orderEntity,res);
        return res;
    }
}
